//
//  SAPTForumableViewCell.m
//  CarsHome
//
//  Created by dapeng on 15/12/7.
//  Copyright © 2015年 dapeng. All rights reserved.
//

#import "SAPTForumableViewCell.h"
#import "Theme-PrefixHeader.pch"
@implementation SAPTForumableViewCell
- (void)dealloc {
    [_forumPIc release];
    [_title release];
    [_bbsname release];
    [_replycounts release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.forumPIc = [[UIImageView alloc] init];
        self.title = [[UILabel alloc] init];
        self.bbsname = [[UILabel alloc] init];
        self.replycounts = [[UILabel alloc] init];
        [_forumPIc release];
        [_title release];
        [_bbsname release];
        [_replycounts release];

        [self addSubview:self.forumPIc];
        [self addSubview:self.title];
        [self addSubview:self.bbsname];
        [self addSubview:self.replycounts];
        [_forumPIc release];
        [_title release];
        [_bbsname release];
        [_replycounts release];
    
    }return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
//    self.forumPIc.frame = CGRectMake(10, 10, SCREEN_SIZE.width / 4, SCREEN_SIZE.width / 5);
    self.title.frame = CGRectMake(10, 10, SCREEN_SIZE.width - SCREEN_SIZE.width / 4 - 20, SCREEN_SIZE.width / 10);
    self.bbsname.frame = CGRectMake(10, SCREEN_SIZE.width / 10 + 10, 100, 20);
    self.replycounts.frame = CGRectMake(SCREEN_SIZE.width - 80, SCREEN_SIZE.width / 10 + 10, 80, 20);
    
}

- (void)setTwoModel:(SAPForumTwoModel *)twoModel {
    if (_twoModel != twoModel) {
        [_twoModel release];
        _twoModel = [twoModel retain];
    }
//    [self.forumPIc sd_setImageWithURL:[NSURL URLWithString:twoModel.smallpic]];
    self.title.text = twoModel.title;
    self.bbsname.text = twoModel.bbsname;
    _bbsname.font = [UIFont systemFontOfSize:12];
    _bbsname.alpha = 0.5;
    self.replycounts.text = [NSString stringWithFormat:@"%@回帖", twoModel.replycounts];
    _replycounts.font = [UIFont systemFontOfSize:12];
    _replycounts.alpha = 0.5;
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString *passWord = [user objectForKey:@"nightModel"];
    
    if (!(passWord == nil) && [passWord isEqualToString:@"day"]) {
        self.backgroundColor = [UIColor colorWithWhite:0.126 alpha:1.000];
        self.title.textColor = RGB(153.0,153.0,153.0,1.0f);;
        self.bbsname.textColor = RGB(153.0,153.0,153.0,1.0f);
        self.replycounts.textColor = RGB(153.0, 153.0, 153.0, 1.0f);
        
    }else{
        self.backgroundColor = [UIColor whiteColor];
        
    }
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
